<?php

class Datasource {
   var $dbLink;

   function Datasource($dbHost, $dbName, $dbuser, $dbpasswd) {
      $this->dbLink = mysql_connect ($dbHost, $dbuser, $dbpasswd);
      mysql_select_db ($dbName, $this->dbLink);
   }

   function execute($sql) {
      $result = mysql_query($sql, $this->dbLink);
      $this->checkErrors($sql);
      return $result;
   }

   function nextRow ($result) {
      $row = mysql_fetch_array($result);
      return $row;
   }

   function checkErrors($sql) {
      $err=mysql_error();
      $errno=mysql_errno();
      if($errno) {
			print mysql_error();
         exit;
      }
      else {
         return;
      }
   }
}

?>